<script lang="jsx">
  export default {
    name: 'CrudTableHander',
    functional: true,
    render(_, { props, scopedSlots }) {
      // console.log(props)
      return (
        <el-table-column
          label="操作"
          align="center"
          props={props}
          scopedSlots={
            {
              default: (scope) => {
                const nodes = scopedSlots?.hander(scope)
                if(!nodes) return null
                const handerNodes = nodes.map( n => {
                  if(!n.componentOptions) return n
                  if(n.componentOptions.propsData === undefined) n.componentOptions.propsData = {}
                  n.componentOptions.propsData.tableData = scope
                  n.componentOptions.propsData.id = scope.row.id
                  return n
                })
                const defaultNodes = scopedSlots.default ? scopedSlots.default(scope) : []
                return [...handerNodes, ...defaultNodes]
              }
            }
          }
        />
      )
    }
  }
</script>
